package com.thkj.modules.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.thkj.common.baseDao.BaseDao;
import com.thkj.modules.user.entity.BusinWorker;

public interface BusinWorkerMapper extends BaseDao<BusinWorker> {

	/**
	 * 查询 根据经营户 查询温度
	 *
	 * @param individual_id
	 * @return datediff(week, 时间字段,
	 */
	@Select("SELECT id,name,age,mobile,address,identity_card as identityCard,work_card as workCard,health_card as healthCard, DATE_FORMAT(entry_time, '%Y-%m-%d') as entryTime,#{timeStr} as timeStr "
			+ "FROM thkj_comm_worker  " + "where individual_id = #{individual_id} " + "ORDER BY DATE(entry_time) DESC ")
	@Results(value = { @Result(column = "id", property = "id", javaType = String.class),
			@Result(column = "name", property = "name", javaType = String.class),
			@Result(column = "age", property = "age", javaType = String.class),
			@Result(column = "mobile", property = "mobile", javaType = String.class),
			@Result(column = "address", property = "address", javaType = String.class),
			@Result(column = "identityCard", property = "identityCard", javaType = String.class),
			@Result(column = "workCard", property = "workCard", javaType = String.class),
			@Result(column = "healthCard", property = "healthCard", javaType = String.class),
			@Result(column = "entryTime", property = "entryTime", javaType = String.class),
			@Result(column = "worker_id=id,timeStr= timeStr", property = "tempertures", many = @Many(select = "com.thkj.dao.TemMeasuringMapper.queryByWorkerId")), })
	List<Map> queryByIndividualId(@Param("individual_id") String individual_id, @Param("timeStr") String timeStr);

}
